﻿/*
* FileReader.cpp
*
* 文件读取
*
* create date: 2014.4.21
* create by: leo
*
*/

#include "FileReader.h"

#include <cstring>

USING_NS_CC;

const char* CFileReader::CreateStringFromFile(const char* filePath)
{
	unsigned long fileSize;
	unsigned char* data = CCFileUtils::sharedFileUtils()->getFileData(filePath, "r", &fileSize);
	char* luaString = new char[fileSize + 1];
	memcpy(luaString, data, fileSize);
	CC_SAFE_DELETE_ARRAY(data);
	luaString[fileSize] = 0;

	return luaString;
}
